package com.xpjhs.menu.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xpjhs.menu.dao.MenuDao;
import com.xpjhs.menu.model.Menu;

@Service
@Transactional(readOnly=true)
public class MenuService {
	@Autowired
	private MenuDao menuDao;
	
	public void saveMenu(Menu menu){
		menuDao.save(menu);
	}
	public void deleteMenu(Menu menu){
		menuDao.delete(menu);
	}
	public void deleteMenuById(long id){
		menuDao.delete(id);
	}
	public void deleteAllMenus(){
		menuDao.deleteAll();
	}
	public List<Menu>listAllMenus(){
		return menuDao.findAll();
	}
}
